package com.deyou.adapter;

import android.widget.CheckBox;

import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.deyou.R;
import com.deyou.model.FacilitySection;

import java.util.List;

/**
 * Created by yangyuancheng on 2017/7/20.
 */

public class FacilitySectionAdapter extends BaseSectionQuickAdapter<FacilitySection, BaseViewHolder> {
    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param layoutResId      The layout resource id of each item.
     * @param sectionHeadResId The section head layout id for each item
     * @param data             A new list is created out of this one to avoid mutable list
     */
    public FacilitySectionAdapter(int layoutResId, int sectionHeadResId, List<FacilitySection> data) {
        super(layoutResId, sectionHeadResId, data);
    }

    @Override
    protected void convertHead(BaseViewHolder helper, FacilitySection item) {
        helper.setText(R.id.tv_facility_head, item.header);
    }

    @Override
    protected void convert(BaseViewHolder helper, FacilitySection item) {
        helper.setText(R.id.tv_facility_name, item.t.dname);
        CheckBox box = helper.getView(R.id.ch_choose_facility);
        helper.addOnClickListener(R.id.ch_choose_facility);
    }
}
